package com.lds.register.center.server.business.appinstance.converter;

import com.lds.register.center.common.model.appinstance.request.AppInstanceBaseUpdateRequest;
import com.lds.register.center.server.business.appinstance.entity.AppInstance;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;


@Component
public class AppInstanceBaseUpdateRequestToEntityConverter implements Converter<AppInstanceBaseUpdateRequest, AppInstance> {

    @Override
    public AppInstance convert(AppInstanceBaseUpdateRequest source) {
        return AppInstance.builder()
                .id(source.getId())
                .modifier(source.getModifier())
                .ip(source.getIp())
                .port(source.getPort())
                .healthy(source.getHealthy())
                .appId(source.getAppId())
                .weight(source.getWeight())
                .enabled(source.getEnabled())
                .build();
    }

}


